

<template>
  <div class="login">
    <el-form class="login-form">
      <el-form-item label="账号" >
        <el-input type="text" v-model="loginForm.username"></el-input>
      </el-form-item>
      <el-form-item label="密码" >
        <el-input type="password" v-model="loginForm.password"></el-input>
      </el-form-item>
      <el-button type="primary" round @click="denglu">登录</el-button>
    </el-form>
  </div>
</template>

<style scoped lang="scss" rel="stylesheet/scss">
.login {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  background-image: url("../assets/images/login-background.jpg");
  background-size: cover;
}
.login-form {
  border-radius: 6px;
  background: #ffffff;
  width: 400px;
  padding: 25px 25px 5px 25px;

  .el-input {
    height: 38px;

    input {
      height: 38px;
    }
  }
}
</style>
<script >
export default {
  name:'abc',
  data(){
    return{
      loginForm:{
        username:"admin",
        password:"admin123",
      }
    }
  },
  methods:{
    denglu(){
      this.$store.dispatch("Login", this.loginForm).then(() => {
        this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
      }).catch(() => {
        console.error("登录异常")
      })
    }
  }
}

</script>
